# 模板1
class Solution:
    def subsets(self, nums: List[int]) -> List[List[int]]:

        n = len(nums)
        ans = []
        path = []


        def dfs(v):
            if v == n:
                ans.append(path.copy())
                return 


            dfs(v+1)

            path.append(nums[v])
            dfs(v+1)
            path.pop()
        
        dfs(0)
        return ans

# 模板二

class Solution:
    def subsets(self, nums: List[int]) -> List[List[int]]:
        n = len(nums)

        ans = []
        path = []

        def dfs(v):
            ans.append(path.copy())
            if n == v:
                return
            
            for i in range(v,n):
                path.append(nums[i])
                dfs(i+1)
                path.pop()

        
        dfs(0)
        return ans